/**
 * Copyright (C) 2007-2011 JUG Events Team <info@jugevents.org>
 *
 * This file is part of JUG Events Web Application.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package it.jugpadova.blo;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import it.jugpadova.dao.LinkedEventDao;
import it.jugpadova.po.LinkedEvent;

/**
 */
@Component
@Transactional
public class LinkedEventBo {
	@Resource
	private LinkedEventDao linkedEventDao;
	
	public LinkedEvent findLinkedEvent(Long id)	
	{
		return linkedEventDao.get(id);
	}	
	
	public void storeLinkedEvent(LinkedEvent linkedEvent)
	{
		linkedEventDao.store(linkedEvent);
	}
	
	public List<LinkedEvent> findAll()
	{
		return linkedEventDao.findAll();
	}
	
	public void deleteLinkedEvent(Long id) {
		LinkedEvent linkedEvent = linkedEventDao.get(id);
		if (linkedEvent == null) {
			throw new RuntimeException("Linked event not found");
		}
		linkedEventDao.delete(linkedEvent);
	}

}
